package controllers.validation;

import java.util.List;

import models.SensorConfig;
import play.Logger;
import play.jobs.Every;
import play.jobs.Job;
import controllers.validation.jobs.NodeValidationJob;
import controllers.validation.jobs.SensorValidationJob;

@Every("6s")
public class NodeJobStarter extends Job {

    public void startNodeValidationJob() {
        List<String> measurementPoints = SensorConfig.getMeasurementPoints();
        Logger.info("Strart NodeValidationJob for MPs: %s", measurementPoints);
        for (String host : measurementPoints) {
            new NodeValidationJob(host).now();
        }
    }

    @Override
    public void doJob() throws Exception {
        startNodeValidationJob();
    }
}
